<?php include HEADER; ?>

<link href="<?php echo __URL_BASE ?>css/jquery-ui.css" rel="stylesheet" type="text/css">
<script src="<?php echo __URL_BASE ?>js/jquery-ui.js" type="text/javascript"></script>

<style>
.slg{
	width: 50px !important;
	padding: 2px !important;
	position: relative;
	top: 1px;
	left: 5px;
}
input[type=radio]{
	position: relative;
	top: 3px;
}
</style>
<?php
	$hoten = (isset($user)) ? $user->HoTen : '';
	$tendangnhap = (isset($user)) ? $user->TenDangNhap : ''; //echo $tendangnhap; die;
	$email = (isset($user)) ? $user->Email : '';
	$diachi = (isset($user)) ? $user->DiaChi : '';
	$dienthoai = (isset($user)) ? $user->DienThoai : '';
	$quyen = (isset($user)) ? $user->Quyen : '';
	$trangthai = (isset($user)) ? $user->TrangThai : '';
?>

<div >
<form method="post" action="<?php echo __URL_BASE.'index.php?rt=admin_user/profile_save' ?>" >

    <table class="TableUpdate" border="1">
    
        <tr>
            <td class="Control" colspan="2">
              <ul>
                <li>
                   <button type="submit" class="uupdate" style="border:none" >Ghi lại</button>
                </li>
                <li>
                  <label class="uback"  >Trở về</label>
                </li>
              </ul></td>
          </tr>
		  <tr >
            <th>Tên đăng nhập :</th>
            <td><input type="text"  class="text" name="ttendangnhap" readonly  value="<?php echo $tendangnhap ?>" <?php if(isset($_REQUEST['user_id'])) echo "readonly"; ?> /></td>
          </tr>
          <tr>
            <th>Họ và tên :</th>
            <td><input type="text"  class="text"  name="thoten" required value="<?php echo $hoten ?>" /></td>
          </tr>
		  <tr>
            <th>Email :</th>
            <td><input type="text"  class="text" id="temail"  name="temail" required value="<?php echo $email ?>" /></td>
          </tr>
		   <tr>
            <th>Điện thoại :</th>
            <td><input type="text"  class="text"  name="tdienthoai" required value="<?php echo $dienthoai ?>" /></td>
          </tr>
		   <tr>
            <th>Địa chỉ :</th>
            <td><input type="text"  class="text"  name="tdiachi" required value="<?php echo $diachi ?>" /></td>
          </tr>
		  
          <tr>
            <td class="Control" colspan="2">
              <ul>
                <li>
                  <button type="submit" class="uupdate" style="border:none" >Ghi lại</button>
                </li>
                <li>
                  <label class="uback"  >Trở về</label>
                </li>
              </ul></td>
          </tr>
    </table>
</form>

 </div>
<?php if(isset($message_user))  echo "<script>alert('".$message_user."');</script>";  ?>
<?php if(isset($message_email))  echo "<script>alert('".$message_email."');</script>";  ?>
<?php include FOOTER; ?>

<script>
	$(document).ready(function(){
		$(".uupdate").click(function(){
			//validate email
			emailVal = $('#temail').val();
			if(!validateEmail(emailVal)){
				alert('Email không hợp lệ.');
				$("#email").select();
				return false;
			}
		});
	});
	function validateEmail($email) {
	  var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
	  if( !emailReg.test( $email ) ) {
		return false;
	  } else {
		return true;
	  }
	}
</script>
<?php if(isset($msg)){echo '<script>alert("'.$msg.'");</script>';} ?>  
